﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AssignmentList.aspx.cs"
    Inherits="WebPortal.AssignmentList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>
        <%= Workflow.Resources.lang.AssignmentList_Title %></title>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <link href="js/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="1" class="table table-border">
            <tr class="banner">
                <td rowspan="1" colspan="4" style="text-align: left;" class="well">
                    <%= Workflow.Resources.lang.AssignmentList_Title %>
                </td>
            </tr>
            <tr align="center" valign="middle">
                <td rowspan="2" class="td-label" valign="middle">
                    <%= Workflow.Resources.lang.AssignmentList_AssignType %>
                </td>
                <td rowspan="2">
                    <div>
                        <table border="0">
                            <tr style="border: 0;">
                                <td style="border: 0;">
                                    <asp:RadioButton ID="RadioButton1" runat="server" GroupName="AssignType" Checked="true" />
                                </td>
                                <td style="border: 0;">
                                    <label for="RadioButton1">
                                        <%= Workflow.Resources.lang.AssignmentList_SelectTaskAssign %></label>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 0;">
                                    <asp:RadioButton ID="RadioButton3" runat="server" GroupName="AssignType" />
                                </td>
                                <td style="border: 0;">
                                    <label for="RadioButton3">
                                        <%= Workflow.Resources.lang.AssignmentList_FutureTasksAssign %></label>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 0;">
                                    <asp:RadioButton ID="RadioButton4" runat="server" GroupName="AssignType" />
                                </td>
                                <td style="border: 0;">
                                    <label for="RadioButton4">
                                        <%= Workflow.Resources.lang.AssignmentList_ProcessAssign %></label>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td rowspan="1">
                    <%= Workflow.Resources.lang.frm_Queue_process %>
                </td>
                <td rowspan="1">
                    <asp:DropDownList ID="dropProcessName" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td rowspan="1">
                    <%= Workflow.Resources.lang.Assign_AssignUser%>
                </td>
                <td rowspan="1">
                    <input id="txtAssignUser" type="text" runat="server" class="inputborder160" readonly="readonly" />
                    <input class="btn" type="button" value="..." onclick="ChooseUser();" />
                    <input id="txtAssignUserAccount" type="hidden" runat="server" />
                    <script type="text/javascript" language="javascript">
                        function ChooseUser() {
                            var returnJson = window.showModalDialog("../Portal/SelectUser.aspx", "javascript", "dialogHeight=450px;dialogWidth=800px;scroll=no;");
                            if (returnJson != null) {
                                var json = eval('(' + returnJson + ')');
                                $("#txtAssignUser").val(json.FullName);
                                $("#txtAssignUserAccount").val(json.Account);
                            }
                        }
                    </script>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:Button ID="Button1" runat="server" CssClass="btn Button" OnClick="Button1_Click" />
                    <asp:Button ID="Button3" runat="server" CssClass="btn Button" OnClientClick="return ResetSearchValue()" />
                    <script type="text/javascript" language="javascript">
                        function ResetSearchValue() {
                            document.getElementById("RadioButton1").setAttribute("checked", "checked");
                            var options = document.getElementById("dropProcessName").children;
                            options[0].setAttribute("selected", "selected");
                            document.getElementById("txtAssignUser").value = "";
                            document.getElementById("txtAssignUserAccount").value = "";
                            document.getElementById("Button1").click();
                            return false;
                        }
                    </script>
                    <asp:Button ID="Button4" runat="server" CssClass="btn Button" Width="90px" OnClientClick="return CheckPage()"
                        OnClick="Button4_Click" />
                    <script type="text/javascript" language="javascript">
                        function CheckPage() {
                            var isCheck = false;
                            var table;
                            if (document.getElementById("RadioButton1").getAttribute("checked") != "") {
                                table = document.getElementById("tbody1");
                            }
                            if (document.getElementById("RadioButton3").getAttribute("checked") != "") {
                                table = document.getElementById("tbody3");
                            }
                            if (document.getElementById("RadioButton4").getAttribute("checked") != "") {
                                table = document.getElementById("tbody4");
                            }
                            $(table).find("tr").each(function () {
                                if ($(this).find("td:eq(0)").children().attr("checked")) {
                                    isCheck = true;
                                }
                            });
                            return isCheck;
                        }
                    </script>
                    <asp:Button ID="Button5" runat="server" CssClass="btn Button" OnClientClick="return GoBack()" />
                    <script type="text/javascript" language="javascript">
                        function GoBack() {
                            //window.returnValue = "";
                            //window.close();
                            window.location.href = "Tasklist.aspx";
                            return false;
                        }
                    </script>
                </td>
            </tr>
        </table>
        <asp:Panel ID="task" runat="server" Visible="false">
            <table class="table table-border">
                <tr class="TableHeader">
                    <th>
                    </th>
                    <th>
                        流程名 Process Name
                    </th>
                    <th>
                        实例号 Incident No
                    </th>
                    <th>
                        步骤名称 Step Name
                    </th>
                    <th>
                        代理人 Assignee
                    </th>
                </tr>
                <tbody id="tbody1">
                    <asp:Repeater ID="TaskList" runat="server">
                        <ItemTemplate>
                            <tr class="TableDataRow">
                                <td>
                                    <input type="checkbox" runat="server" id="Task_checkbox" value='<%# Eval("TASKID") %>' />
                                </td>
                                <td>
                                    <%# Eval("PROCESSNAME")%>
                                </td>
                                <td>
                                    <%# Eval("INCIDENT")%>
                                </td>
                                <td>
                                    <%# Eval("STEPLABEL")%>
                                </td>
                                <td>
                                    <%# Eval("ASSIGNEDTOUSER")%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </asp:Panel>
        <asp:Panel ID="FutureTasks" runat="server" Visible="false">
            <table class="table table-border">
                <tr class="TableHeader">
                    <th>
                    </th>
                    <th>
                        流程名 Process Name
                    </th>
                    <th>
                        步骤名称 Step Name
                    </th>
                    <th>
                        代理人 Assignee
                    </th>
                    <th>
                        到期时间 Due Time
                    </th>
                </tr>
                <tbody id="tbody3">
                    <asp:Repeater ID="FutureTasksList" runat="server">
                        <ItemTemplate>
                            <tr class="TableDataRow">
                                <td>
                                    <input type="checkbox" runat="server" id="FutureTasksList_checkbox" />
                                </td>
                                <td>
                                    <asp:Label ID="FutureTasksList_ProcessName" runat="server" Text='<%# Eval("PROCESSNAME")%>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="FutureTasksList_StepName" runat="server" Text='<%# Eval("STEPLABEL")%>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="FutureTasksList_AssignedToUser" runat="server" Text='<%# Eval("ASSIGNEDTOUSER")%>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="FutureTasksList_Assignuntil" runat="server" Text='<%# Eval("ASSIGNUNTIL")%>'></asp:Label>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </asp:Panel>
        <asp:Panel ID="Processes" runat="server" Visible="false">
            <table class="table table-condensed table-bordered">
                <tr>
                    <th>
                    </th>
                    <th>
                        流程名 Process Name
                    </th>
                    <th>
                        代理人 Assignee
                    </th>
                    <th>
                        开始时间 Begin Date
                    </th>
                    <th>
                        结束时间 End date
                    </th>
                </tr>
                <tbody id="tbody4">
                    <asp:Repeater ID="ProcessesList" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <input id="Processes_checkbox" type="checkbox" runat="server" value='<%# Eval("ID") %>' />
                                </td>
                                <td>
                                    <%# Eval("ProcessName")%>
                                </td>
                                <td>
                                    <%# Eval("TskAssignUser")%>
                                </td>
                                <td>
                                    <%# Eval("BgDate")%>
                                </td>
                                <td>
                                    <%# Eval("EdDate")%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
